package sel.me.spring.boot159.web.constant;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

/**
 * @author shenenlu 2021年04月15日 下午16:10:37
 */
public enum DocumentOperationBizTypeEnum {

    ALLOCATE(1001, "分拨"),


    ;


    private int type;
    private String desc;
    private static Map<Integer, DocumentOperationBizTypeEnum> ENUM_MAP;

    static {
        Map<Integer, DocumentOperationBizTypeEnum> map = new HashMap<>();
        for( DocumentOperationBizTypeEnum documentOperationBizType: DocumentOperationBizTypeEnum.values()){
            map.put(documentOperationBizType.type, documentOperationBizType);
        }
        ENUM_MAP = Collections.unmodifiableMap(map);
    }


    public static DocumentOperationBizTypeEnum get(int type){
        DocumentOperationBizTypeEnum documentOperationBizTypeEnum = ENUM_MAP.get(type);
        if( documentOperationBizTypeEnum == null ){
           throw new IllegalArgumentException("wrong DocumentOperationBizTypeEnum, type=" + type);
        }
        return documentOperationBizTypeEnum;
    }

    DocumentOperationBizTypeEnum(int type, String desc) {
        this.type = type;
        this.desc = desc;
    }
}
